Skip to content

Chore/update prefixes#219

Merged
ammodev merged 2 commits into
version/1.21.11from
chore/update-prefixes
Feb 10, 2026
Merged

Chore/update prefixes#219
ammodev merged 2 commits into
version/1.21.11from
chore/update-prefixes

Conversation

@ammodev

@ammodev ammodev commented Feb 10, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings February 10, 2026 11:07
@ammodev ammodev merged commit 89958bc into version/1.21.11 Feb 10, 2026
4 of 5 checks passed
@ammodev ammodev deleted the chore/update-prefixes branch February 10, 2026 11:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the message prefix system in surf-api-core-api by centralizing prefix construction in Colors and introducing type-specific async helpers for prefix + newline composition, while deprecating the generic “prefixed line” helpers on SurfComponentBuilder.

Changes:

  • Refactors Colors to generate PREFIX/INFO_PREFIX/SUCCESS_PREFIX/WARNING_PREFIX/ERROR_PREFIX via a shared buildPrefix(...) helper.
  • Adds appendNew{Type}PrefixedLineAsync(...) helpers to the Info/Success/Warning/Error component builder color interfaces.
  • Deprecates SurfComponentBuilder.appendNewPrefixedLine(...) and appendNewPrefixedLineAsync(...) in favor of type-specific helpers.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.../builder/colors/WarningComponentBuilderColor.kt Adds async helper to append newline + warning prefix and then append async block.
.../builder/colors/SuccessComponentBuilderColor.kt Adds async helper to append newline + success prefix and then append async block.
.../builder/colors/InfoComponentBuilderColor.kt Adds async helper to append newline + info prefix and then append async block.
.../builder/colors/ErrorComponentBuilderColor.kt Adds async helper to append newline + error prefix and then append async block.
.../builder/SurfComponentBuilder.kt Deprecates generic prefixed-line helpers to steer callers toward type-specific APIs.
.../messages/Colors.kt Centralizes prefix rendering with PREFIX_CHARACTER + `

Comment on lines +57 to 59
@Deprecated("Use TYPE specific functions")
fun appendNewPrefixedLine(block: SurfComponentBuilder.() -> Unit) =
appendNewPrefixedLine().append(block)

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @deprecated message "Use TYPE specific functions" is unclear to API consumers (what is "TYPE" and which functions should they migrate to?). Consider making the message explicit (e.g., refer to appendNewInfoPrefixedLine/appendNewSuccessPrefixedLine/etc.) so the deprecation warning is actionable.

Copilot uses AI. Check for mistakes.
Comment on lines +61 to 63
@Deprecated("Use TYPE specific functions")
suspend fun appendNewPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewPrefixedLine().appendAsync(block)

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: the deprecation message is not actionable. If appendNewPrefixedLineAsync is being replaced by type-specific async helpers, the message should point to the concrete replacements to avoid confusing downstream plugin authors.

Copilot uses AI. Check for mistakes.
Comment on lines 117 to 123
/**
* The default prefix color (#3b92d1).
* Applied to all prefixes for consistency across Surf plugins.
*/
@JvmField
val PREFIX_COLOR: TextColor = PRIMARY

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KDoc for PREFIX_COLOR says it is "applied to all prefixes", but INFO_PREFIX/SUCCESS_PREFIX/WARNING_PREFIX/ERROR_PREFIX now call buildPrefix(INFO/SUCCESS/WARNING/ERROR) instead of PREFIX_COLOR. Either update the KDoc to reflect the per-type coloring, or pass PREFIX_COLOR to buildPrefix for all prefixes if the intent is consistency.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants